/*
 * Copyright (c) 2020 Fraunhofer FOKUS and others. All rights reserved.
 *
 * See the NOTICE file(s) distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License 2.0 which is available at
 * http://www.eclipse.org/legal/epl-2.0
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contact: mosaic@fokus.fraunhofer.de
 */
package org.eclipse.mosaic.lib.transform;

import org.eclipse.mosaic.lib.geo.GeoPoint;
import org.eclipse.mosaic.lib.geo.MutableCartesianPoint;
import org.eclipse.mosaic.lib.geo.MutableGeoPoint;
import org.eclipse.mosaic.lib.geo.UtmZone;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;

@RunWith(MockitoJUnitRunner.class)
public class WictWgs84ProjectionTest {

    double longitude = 106.330088;
    double latitude = 29.518218;


    @Test
    public void testFormat() {
        String result = String.format("+proj=tmerc +lat_0=%.5f +lon_0=%.5f +k=1 +x_0=0 +y_0=0 " +
                "+datum=WGS84 +units=m +no_defs", latitude, longitude);

        System.out.println(result);

        MutableGeoPoint point = new MutableGeoPoint(latitude, longitude);
        UtmZone zone = UtmZone.from(point);
        result = String.format("+proj=utm +zone=%d +ellps=WGS84 +datum=WGS84 +units=%s +no_defs",
                zone.number, zone.letter);

        System.out.println(result);
    }

    @Test
    public void testkexuegu() {
        MutableGeoPoint center = new MutableGeoPoint(29.547298293592245, 106.3541443176812);
        WictWgs84Projection projection = new WictWgs84Projection(center);

        GeoPoint geoPoint = projection.cartesianToGeographic(new MutableCartesianPoint(400.52, 581.33, 0));

        System.out.println("geoPoint lat:" + geoPoint.getLatitude() + ", long:" + geoPoint.getLongitude());
    }
}
